from app.controllers.base_controller import BaseController
from app.crud.role_crud import RoleCRUD
from app.models import Role
from app.schemas.result_schema import ResultFormat, ResultModel
from app.schemas.role_schema import RoleUpdate, RoleCreate, RoleAssignPermission


class RoleController(BaseController[RoleCRUD,Role,RoleCreate,RoleUpdate]):
    async def assign_permissions(self, permission: RoleAssignPermission) -> ResultModel[bool]:
        result = await self.crud.assign_permissions(permission=permission)
        return ResultFormat.result_bool(data=result, model_name="分配权限")
